#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Módulos 
import sys, gtk, pygame, utils
from pygame.locals import *
# Constantes
 
# Clases
# ---------------------------------------------------------------------

class Boton(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = utils.load_image("images/flecha.gif", True)
        self.rect = self.image.get_rect()
        self.rect.centerx = 700*utils.RES
        self.rect.centery = 480*utils.RES
        self.sonido = pygame.mixer.Sound("sounds/recycle.wav")
	
# ---------------------------------------------------------------------
 
# Funciones
# --------------------------------------------------------------------- 
def dibujar(screen,cursor_picture, clock):

	salir = 0
	background_image = utils.load_image('images/presentacion.jpg')
	boton = Boton()
	if pygame.key.get_focused:
		inicio = pygame.mixer.Sound("sounds/inicio.ogg")		
	inicio.play()	
			
	while salir == 0:
		
		# Pump GTK messages.
		while gtk.events_pending():
		   gtk.main_iteration()

		for eventos in pygame.event.get():
			if eventos.type == QUIT:
				sys.exit(0)
			elif eventos.type == pygame.KEYDOWN:
				salir = 1
			#elif eventos.type == pygame.UP:
			#	salir = 1		
				#teclas = pygame.key.get_pressed()
				#if teclas[K_q]:	
			elif eventos.type == pygame.VIDEORESIZE:
			   pygame.display.set_mode(eventos.size, pygame.RESIZABLE)	
			elif eventos.type == MOUSEBUTTONDOWN:
				if boton.rect.collidepoint(pygame.mouse.get_pos()):
					boton.sonido.play()	
					salir = 1
					

		screen.blit(background_image, (0, 0))
		screen.blit(boton.image, boton.rect)
		screen.blit(cursor_picture, pygame.mouse.get_pos())
		pygame.display.flip()
			 
		# Try to stay at 30 FPS
		clock.tick(30)
			 
	inicio.stop()	
	return salir

 
# ---------------------------------------------------------------------



